package gaml.yaml;

import gaml.yaml.ahchor.YamlAnchor;

import java.util.ArrayList;
import java.util.HashMap;


/**
 * repeat reference on object defined by it's anchor's alias
 * @author shnireck
 *
 */
public class AliasNode extends YamlNode {
	public AliasNode (YamlNode parent, YamlAnchor anchor) {
		this.anchor= anchor.setUsed ();
		this.parent = parent; 
		if (null != parent) this.level = parent.getLevel () + 1;
	}

	@Override
	public YamlNode addChild (YamlNode value) { return null; }

	@Override
	public YamlNode addChild (YamlNode key, YamlNode val) { return this; }

	@Override
	public YamlNode getChild (YamlNode key) { return null; }

	@Override
	public YamlNode getChild (int index) { return null; }

	@Override
	public ArrayList <YamlNode> getSequenceChildren () { return new ArrayList <YamlNode> (); }

	@Override
	public HashMap <YamlNode, YamlNode> getMappingChildren () { return new HashMap <YamlNode, YamlNode> (); }

	@Override
	public String getValue () { return null; }

	@Override
	public YamlNode setValue (String value) { return this; }

	@Override
	public boolean isEmpty () { return ((null == (anchor.getNode ())) || (anchor.getNode ().isEmpty ())); }
}
